home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Text / Edit / Vim / doc / difference.doc < prev    next >
Text File  |  1994-08-09  |  21KB  |  493 lines

  1.  
  2.  
  3. This is a summary of the differences between VIM and vi. It is not complete.
  4. see also reference.doc and look for comments in {}.
  5.  
  6.  
  7. The most interesting additions:
  8.  
  9. Vi compatibility.
  10. When the 'compatible' option is set, all options are given a vi-compatible
  11. value. Vim will behave like the "real" vi as much as possible.
  12.  
  13.  
  14. Multi level undo.
  15. 'u' goes backward in time, 'ctrl-R' goes forward again. Set option 
  16. 'undolines' to the number of changes to be remembered (default 100). Set 
  17. 'undolines' to 0 for vi-compatible one level undo.
  18.  
  19. When all changes in a buffer have been undone, the buffer is not considered
  20. changed anymore. You can exit it with :q, without <!>.
  21.  
  22.  
  23. Multiple windows and buffers.
  24. Vim can split the screen into several windows, each editing a different
  25. buffer or the same buffer at a different location. Buffers can still be
  26. loaded (and changed) but not displayed in a window. This is called a hidden
  27. buffer. Many commands and options have been added for this facility, see
  28. windows.doc.
  29.  
  30.  
  31. Repeat a series of commands.
  32. 'q'<c> starts recording typed characters into named register <c> (append to
  33. the register if register name is upper case). A subsequent 'q' stops
  34. recording. The register can then be executed with the '@'<c> command. This is
  35. very useful to repeat a complex action.
  36.  
  37.  
  38. Flexible insert mode.
  39. The arrow keys can be used in insert mode to move around in the file. This 
  40. breaks the insert in two parts as far as undo and redo is concerned.
  41.  
  42. CTRL-O can be used to execute a single command-mode command. This is almost 
  43. the same as hitting ESC, typing the command and hitting 'a'. For undo/redo 
  44. only those inserts are remembered where something was actually inserted.
  45.  
  46.  
  47. Visual mode.
  48. Visual can be used to first choose a piece of text and then give a command 
  49. to do something with it. This is an (easy to use) alternative to first giving 
  50. the operator and then moving to the end of the text to be operated upon. 'v' 
  51. and 'V' are used to start Visual mode. 'v' works on characters and 'V' on
  52. lines. Move the cursor to extend the Visual part. It is shown highlighted on
  53. the screen. By typing 'o' the other end of the Visual text can be moved. The
  54. Visual text can be affected by an operator:
  55.     d    delete
  56.     c    change
  57.     y    yank
  58.     > or <    insert or delete indent
  59.     !    filter through external program
  60.     =    filter through indent
  61.     :    start ":" command for the Visual lines.
  62.     Q    format text to 'textwidth' columns
  63.     J    join lines
  64.     ~    swap case
  65.     u    make lowercase
  66.     U    make uppercase
  67.  
  68.  
  69. Block operators.
  70. With Visual a rectangular block of text can be selected. Start Visual with 
  71. CTRL-V. The block can be deleted ('d'), yanked ('y') or its case can be 
  72. changed ('~', 'u' and 'U'). A deleted or yanked block can be put into the
  73. text with the 'p' and 'P' commands.
  74.  
  75.  
  76. Online help.
  77. ':help' command and help key (F1 for MSDOS) display several pages of concise 
  78. help. The name of the help file can be set with the "helpfile" option.
  79.  
  80.  
  81. Command line editing.
  82. You can insert or delete at any place in the command line using the cursor 
  83. keys. The right/left cursor keys can be used to move forward/backward one 
  84. character. The shifted right/left cursor keys can be used to move 
  85. forward/backward one word. CTRL-B/CTRL-E can be used to go to the begin/end
  86. of the command line.
  87.  
  88. The command lines are remembered. The up/down cursor keys can be used to 
  89. recall previous command lines. The 'history' option can be set to the number 
  90. of lines that will be remembered.
  91.  
  92.  
  93. Command line completion.
  94. While entering a command line (on the bottom line of the screen) <TAB> can be 
  95. typed to complete
  96.    what        example        where
  97. - a command    :e<TAB>        at start of command line
  98. - a tag        :ta no<TAB>    after :ta
  99. - an option    :set sc<TAB>    after :set
  100. - a filename    :e v<TAB>    after any command that accepts a filename
  101.  
  102. If there are multiple matches, CTRL-N (next) and CTRL-P (previous) will walk
  103. through the matches. <TAB> works line CTRL-N, but wraps around to the first
  104. match.
  105.  
  106. The 'wildchar' option can be set to the character for command line
  107. completion, <TAB> is the default. CTRL-D can be typed after an (incomplete)
  108. wildcard; all matches will be listed. CTRL-A will insert all matches.
  109. CTRL-L will insert the longest common part of the matches.
  110.  
  111.  
  112. Horizontal scrolling.
  113. If the 'wrap' option is off, long lines will not wrap and only part of them
  114. will be shown. When the cursor is moved to a part that is not shown, the
  115. screen will scroll horizontally. The minimal number of columns to scroll can
  116. be set with the 'sidescroll' option.
  117.  
  118.  
  119. Text formatting.
  120. The 'textwidth' (tw) option can be used to automatically limit the line 
  121. length. This supplements the 'wrapmargin' option of Vi, which was not very 
  122. useful. The 'Q' operator can be used to format a piece of text ("Q}" formats 
  123. a paragraph). Commands for text alignment: ":center", ":left" and ":right".
  124.  
  125.  
  126. Edit-compile-edit speedup.
  127. The ":make" command can be used to run the compilation and jump to the first
  128. error. Alternatively Vim can be started with the "-e" option from the
  129. compiler. A file with compiler error messages is interpreted. Each line in
  130. the error file is scanned for the name of a file, line number and error
  131. message. Vim starts editing at the first error. Optionally the name of the
  132. error file can be given with "-e errorfile". The ":cn" command can be used to
  133. jump to the next error. ":cl" lists all the error messages. Other commands
  134. are available (almost the same as with Manx's Z editor). The 'errorfile'
  135. option has the name of the file with error messages. The 'errorformat' option
  136. can be set to a scanf-like string to handle output from many compilers. The
  137. 'makeprg' option contains the name of the program to be executed with the
  138. ":make" command. The 'shellpipe' option contains the string to be used to put
  139. the output of the compiler into the errorfile.
  140.  
  141.  
  142. Command line options:
  143.  
  144. When Vim is started with "-v" (View) then readonly mode is used (includes 
  145. "-n").
  146.  
  147. When Vim is started with "-b" (Binary) then some options are set to be able
  148. to edit binary or executable files.
  149.  
  150. When Vim is started with "-s scriptfile", the characters read from 
  151. "scriptfile" are treated as if you typed them. If end of file is reached 
  152. before the editor exits, further characters are read from the console.
  153.  
  154. The "-w" option can be used to record all typed characters in a script file. 
  155. This file can then be used to redo the editing, possibly on another file or 
  156. after changing some commands in the script file.
  157.  
  158. The "-n" option disables the writing of a ".swp" file (see below).
  159.  
  160. The "-c command" option does the same as the the "+command" option.
  161.  
  162. The "-T terminal" option sets the terminal type.
  163.  
  164. The "-e" option starts Vim in quickfix mode.
  165.  
  166. The "-o" option opens a window for each argument. "-o4" opens four windows.
  167.  
  168.  
  169. In command mode:
  170.  
  171. Missing command: 'Q' (go to Ex mode).
  172. Missing Ex commands: append, change, insert, open, recover and z.
  173.  
  174. The command characters are shown in the last line of the screen. They are 
  175. removed when the command is finished. If you do not want this (on a slow 
  176. terminal) reset the 'showcmd' option.
  177.  
  178. If the 'ruler' option is set, the current cursor position is shown in the 
  179. last line of the screen.
  180.  
  181. 'u' and CTRL-R accept a count for the number of undos/redos.
  182.  
  183. 'U' still works after having moved off of the last changed line and after 
  184. 'u'.
  185.  
  186. Nulls in the file are replaced by <LF> internally. This allows editing of 
  187. binary files (more or less).
  188.  
  189. Characters with the 8th bit set are displayed. The characters between '~' and 
  190. 0xa0 are displayed as "~?", "~@", "~A", etc., unless the "graphic' option is 
  191. set.
  192.  
  193. '=' is an operator to filter lines through an external command (vi: lisp 
  194. stuff). The name of the command can be set with the 'equalprg' option. The 
  195. default is "indent".
  196.  
  197. '][' goes to the next ending of a C function ('}' in column 1).
  198. '[]' goes to the previous ending of a C function ('}' in column 1).
  199.  
  200. ']f', '[f' and 'gf' start editing the file whose name is under the cursor.
  201. CTRL-W f splits the window and starts editint the file whose name is under
  202. the cursor.
  203.  
  204. '*' searches forward for the identifier under the cursor, '#' backward.
  205. 'K' runs the program defined by the "keywordprg" option, with the identifier 
  206. under the cursor as argument.
  207.  
  208. '%' can be preceded with a count. The cursor jumps to the line that 
  209. percentage down in the file. The normal '%' function to jump to the matching
  210. brace skips braces inside quotes.
  211.  
  212. With the CTRL-] command, the cursor may be in the middle of the identifier.
  213.  
  214. The used tags are remembered. Commands that can be used with the tag stack 
  215. are CTRL-T, ':pop' and ':tag'. ':tags' lists the tag stack.
  216.  
  217. The 'tags' option can be set to a list of tag file names. Thus multiple 
  218. tag files can be used.
  219.  
  220. Previously used file names are remembered in the alternate file name list.
  221. CTRL-^ accepts a count, which is an index in this list.
  222.  
  223. Search patterns have more features. The <NL> character is seen as part of the
  224. search pattern and the substitute string of ":s". Vi sees it as the end of
  225. the command.
  226.  
  227. Searches can put the cursor on the end of a match and may include a character
  228. offset.
  229.  
  230. Count added to '~', ':next', ':Next', 'n' and 'N'.
  231.  
  232. The command ":next!" with 'autowrite' set does not write the file. In vi the
  233. file was written, but this is considered to be a bug, because one does not
  234. expect it and the file is not written with ':rewind!'.
  235.  
  236. "5r<CR>" replaces five characters by five line breaks. Vi replaces five
  237. characters with a single line break.
  238.  
  239. Added :wnext command. Same as ":write" followed by ":next".
  240.  
  241. The ":w!" command always writes, also when the file is write protected.
  242.  
  243. If option "tildeop" has been set, '~' is an operator (must be followed by a 
  244. movement command).
  245.  
  246. With the 'J' (join) command you can reset the 'joinspaces' (js) option to 
  247. have only one space after a period (Vi inserts two spaces).
  248.  
  249. 'cw' can be used to change white space formed by several characters (Vi is 
  250. confusing: 'cw' only changes one space, while 'dw' deletes all white space).
  251.  
  252. 'o' and 'O' accept a count for repeating the insert (Vi clears a part of 
  253. display).
  254.  
  255. ':dis' command shows the contents of the yank register.
  256.  
  257. Previously used file names are remembered in the alternate file name list.
  258. ":files" command shows the list of alternate filenames.
  259. '#'<N> is replaced by the <N>th alternate filename in the list.
  260. "#<" is replaced by the current filename without extension.
  261.  
  262. Flags after command not supported (no plans to include it).
  263.  
  264. On non-UNIX systems ":cd" command shows current directory instead of going to
  265. the home directory. ":pwd" prints the current directory on all systems.
  266.  
  267. ':source!' command reads Vi commands from a file.
  268.  
  269. ':mkexrc' command writes current modified options and mappings to a ".exrc" 
  270. file. ':mkvimrc' writes to a ".vimrc" file.
  271.  
  272. No check for "tail recursion" with mappings. This allows things like
  273. ":map! foo ^]foo".
  274.  
  275. The :put! command inserts the contents of a register above the current line.
  276.  
  277. The 'p' and 'P' commands of vi cannot be repeated with '.' when the putted
  278. text is less than a line. In Vim they can always be repeated.
  279.  
  280. The named register '.' can be used with commands p, P and :put. The contents 
  281. of the register is the last inserted text.
  282.  
  283. ":noremap" command can be used to enter a mapping that will not be remapped.
  284. This is useful to exchange the meaning of two keys. ":cmap", ":cunmap" and
  285. ":cnoremap" can be used for mapping in command line editing only. ":imap",
  286. ":iunmap" and ":inoremap" can be used for mapping in insert mode only.
  287. Similar commands exist for abbreviations: ":noreabbrev", ":iabbrev"
  288. ":cabbrev", ":iunabbrev", ":cunabbrev", ":inoreabbrev", ":cnoreabbrev".
  289.  
  290. In vi the command ":map foo bar" would remove a previous mapping
  291. ":map bug foo". This is considered a bug, so it is not included in Vim.
  292. ":unmap! foo" does remove ":map! bug foo", because unmapping would be very
  293. difficult otherwise (this is vi compatible).
  294.  
  295. ":@r" command executes register r (is in some versions of vi).
  296.  
  297. The ':' register contains the last command line.
  298. The '%' register contians the current file name.
  299.  
  300. CTRL-O/CTRL-I can be used to jump to older/newer positions. These are the 
  301. same positions as used with the '' command, but may be in another file. The 
  302. ':jumps' command lists the older positions.
  303.  
  304. If the 'shiftround' option is set, an indent is rounded to a multiple of 
  305. 'shiftwidth' with '>' and '<' commands.
  306.  
  307. The 'scrolljump' option can be set to the minimal number of lines to scroll 
  308. when the cursor gets off the screen. Use this when scrolling is slow.
  309.  
  310. Uppercase marks can be used to jump between files. The ':marks' command lists 
  311. all currently set marks. The commands "']" and "`]" jump to the end of the 
  312. previous operator or end of the text inserted with the put command. "'[" and 
  313. "`[" do jump to the start.
  314.  
  315. The 'shelltype' option can be set to reflect the type of shell used.
  316.  
  317. The 'highlight' option can be set for the higlight mode to be used for
  318. several commands.
  319.  
  320. The CTRL-A (add) and CTRL-X (subtract) commands are new. The count to the 
  321. command (default 1) is added to/subtracted from the number at or after the 
  322. cursor. That number may be decimal, octal (starts with a '0') or hexadecimal 
  323. (starts with '0x'). Very useful in macros.
  324.  
  325. With the :set command the prefix "inv" can be used to invert toggle options.
  326.  
  327. In both Vi and Vim you can create a line break with the ":substitute" command
  328. by using a CTRL-M. For Vi this means you cannot insert a real CTRL-M in the
  329. text. With Vim you can put a real CTRL-M in the text by preceding it with a
  330. CTRL-V.
  331.  
  332.  
  333. In insert mode:
  334.  
  335. If the 'revins' option is set, insert happens backwards. This is for typing
  336. Hebrew. When inserting normal characters the cursor will not be shifted and
  337. the text moves rightwards. In replace mode the cursor will move leftwards.
  338. Backspace, CTRL-W and CTRL-U will also work in the opposite direction. CTRL-B
  339. toggles the 'revins' option.
  340.  
  341. The backspace key can be used just like CTRL-D to remove auto-indents.
  342.  
  343. You can backspace, ctrl-U and CTRL-W over line breaks if the 'backspace' (bs) 
  344. option is set to non-zero. You can backspace over the start of insert if the 
  345. 'backspace' option is set to 2.
  346.  
  347. When the 'paste' option is set, a few option are reset and mapping in insert
  348. mode and abbreviation are disabled. This allows for pasting text in windowing
  349. systems without unexpected results. When the 'paste' option is reset, the old
  350. option values are restored.
  351.  
  352. CTRL-T/CTRL-D always insert/delete an indent in the current line, no matter 
  353. what column the cursor is in.
  354.  
  355. CTRL-@ (insert previously inserted text) works always (Vi: only when typed as 
  356. first character).
  357.  
  358. CTRL-A works like CTRL-@ but does not leave insert mode.
  359.  
  360. CTRL-R <0-9a-z> can be used to insert the contents of a register.
  361.  
  362. When the 'smartindent' (si) option is set, C programs will be better 
  363. auto-indented.
  364.  
  365. CTRL-Y and CTRL-E can be used to copy a character from above/below the 
  366. current cursor position.
  367.  
  368. After CTRL-V you can enter a three digit decimal number. This byte value is 
  369. inserted in the text as a single character. Useful for international 
  370. characters that are not on your keyboard.
  371.  
  372. When the 'expandtab' (et) option is set, a <TAB> is expanded to the 
  373. appropriate number of spaces.
  374.  
  375. The window always reflects the contents of the buffer (Vi does not do this 
  376. when changing text and in some other cases).
  377.  
  378. If Vim is compiled with DIGRAPHS defined, digraphs are supported. A set of 
  379. normal Amiga digraphs is included. They are shown with the :digraph" command. 
  380. More can be added with ":digraph {char1}{char2} {number}". A digraph is 
  381. entered with "CTRL-K {char1} {char2}" or "{char1} BS {char2}" (only when 
  382. 'digraph' option is set).
  383.  
  384. When repeating an insert, e.g. "10atest <ESC>" vi would only handle wrapmargin
  385. for the first insert. Vim does it for all.
  386.  
  387.  
  388. In command line mode:
  389.  
  390. ESC terminates the command line without executing it. In vi the command line
  391. would be executed, which is not what most people expect (hitting ESC should
  392. always get you back to command mode). To avoid problems with some
  393. obscure macros, an ESC in a macro will execute the command. If you want a
  394. typed ESC to execute the command like vi does you can fix this with
  395.     ":cmap ^V<ESC> ^V<CR>"
  396.  
  397. general:
  398.  
  399. Missing options: autoprint (ap), beautify (bf), edcompatible, hardtabs (ht), 
  400. lisp, mesg, open, optimize (op), prompt, redraw, slowopen (slow), terse,
  401. window, w300, w1200 and w9600. These options can be set but are otherwise
  402. ignored.
  403.  
  404. When the 'compatible' option is set, all options are set for maximum 
  405. vi-compatibility
  406.  
  407. The 'ttimeout' option is like 'timeout', but only works for cursor and 
  408. function keys, not for ordinary mapped characters. The 'timoutlen' option
  409. gives the number of milliseconds that is waited for. If the 'esckeys' option
  410. is not set, cursor and function keys that start with <ESC> are not recognized
  411. in insert mode.
  412.  
  413. There is an option for each terminal string. Can be used when termcap is not 
  414. supported or to change individual strings.
  415.  
  416. When the 'textmode' option is set (default for MSDOS) <CR><LF> is used as
  417. line separator. When reset (default for Unix and Amiga) <LF> is used. When
  418. the 'textauto' option is set, Vim tries to detect the type of line separator
  419. used by reading up to the first <LF>. The 'textmode' option is set
  420. accordingly.
  421.  
  422. On systems that have no job control (most systems but BSD-UNIX) the CTRL-Z, 
  423. ":stop" or ":suspend" command starts a new shell.
  424.  
  425. If Vim is started on the Amiga without an interactive window for output, a 
  426. window is opened (and :sh still works). You can give a device to use for 
  427. editing with the '-d' argument, e.g. "-d con:20/20/600/150".
  428.  
  429. On startup the VIMINIT or EXINIT environment variables, the file s:.vimrc or 
  430. s:.exrc and .vimrc or .exrc are read for initialization commands. When 
  431. reading .vimrc and .exrc some commands are not allowed because of security 
  432. reasons (shell commands and writing to a file, :map commands are echoed). 
  433. This can be overrided with the 'secure' option.
  434.  
  435. Line lenght can be at least upto the maximum value of an int (for the Amiga
  436. 32767 characters, for most 32-bit systems much larger). Editing such lines is
  437. not always possible. File length upto 2147483646 lines. If a line is larger
  438. than the screen, the last line is filled with <@>s and only the part of the
  439. line before that is shown (unless 'wrap' option is reset).
  440.  
  441. The 'columns' option is used to set or get the width of the display.
  442.  
  443. The name of the current file name is shown in the title bar of the window.
  444.  
  445. Wildcards in file names are expanded.
  446.  
  447. Option settings are read from the first and last few lines of the file. 
  448. Option 'modelines' determines how many lines are tried (default is 5). Note 
  449. that this is different from the Vi versions that can execute any Ex command 
  450. in a modeline (a major security problem).
  451.  
  452. If the 'insertmode' option is set (e.g. in .exrc), Vim starts in insert mode.
  453.  
  454. All text is kept in memory. Available memory limits the file size (and other 
  455. things such as undo). This may be a problem with MSDOS, is hardly a problem 
  456. ont the Amiga and almost never with Unix.
  457.  
  458. If the 'backup' or 'writebackup' option is set: Before a file is overwritten, 
  459. a backup file (.bak) is made. If the "backup" option is set it is left 
  460. behind.
  461.  
  462. If the 'binary' option is set and the file does not have an end-of-line for
  463. the last line, the end-of-line is not appended when writing.
  464.  
  465. Vim creates a file ending in ".swp" to store parts of the file that have been
  466. changed or that do not fit in memory. This file can be used to recover from
  467. an aborted editing session with "vim -r file". Using the swap file can be
  468. switched off by setting the 'updatecount' option to 0 or starting Vim with
  469. the "-n" option. Use the 'directory' option for placing the .swp file
  470. somewhere else.
  471.  
  472. The 'shortname' (sn) option, when set, tells Vim that ".bak" and ".swp" 
  473. filenames are to be MSDOS-like: 8 characters plus 3 for extention. This 
  474. should be used on messydos or crossdos filesystems on the Amiga. If this 
  475. option is off, Vim tries to guess if MSDOS filename restrictions are 
  476. effective.
  477.  
  478. Recovery after a crash has a smaller chance for success, because there is no 
  479. temporary file.
  480.  
  481. Error messages are shown at least one second (Vi overwrites error messages).
  482.  
  483. If Vim asks to "Hit RETURN to continue", you can hit any key. Characters 
  484. other than <CR>, <LF> and <SPACE> are interpreted as the (start of) a 
  485. command. (Vi only accepts a command starting with ':').
  486.  
  487. The contents of the numbered and unnamed registers is remembered when
  488. changing files.
  489.  
  490. The AUX: device of the Amiga is supported.
  491.  
  492. vi:tw=77:
  493.